<?php 
	include('template/header.php');
	include('classess/user_subscribe.php');
?>
	<style>
		.right_container{
			margin-top:0px;
		}
	</style>
	<!-- Page Content -->
	<section  class="homepage-slider" id="home-slider">
		<div class="flexslider">
			<ul class="slides">
				<li>
					<img src="img/slider/first_image.jpg" alt="No Image" />					
				</li>
				<li>
					<img src="img/slider/second_image.jpg" alt="No Image" />					
				</li>
			</ul>
		</div>			
	</section>
	<section class="header_text sub">
		<h4><span>Course Description</span></h4>
		<?php
			if(isset($_GET['ref_by'])){
				$select_query = "SELECT * FROM tbl_affiliate WHERE reference_url='".$_GET['ref_by']."'";
				$mysql_query = mysql_query($select_query) or die(mysql_error());

				$count_rows = mysql_num_rows($mysql_query);
				
				if($count_rows>0){
					while($row = mysql_fetch_array($mysql_query)){
						$_SESSION['reffered_by'] = $row['id']; 
					}
				}
			}

			if(isset($_SESSION['pwd_msg'])){
				$_SESSION['pwd_msg'] = '';
			}
		?>
	</section>
	<section class="main-content">				
		<div class="row">						
			<div class="span9">
				<div class="row">
					<?php 
						if(!isset($_GET['ebk_chk'])){
							if(isset($_GET['c_id'])){
								$select_single_course = "SELECT * FROM tbl_courses WHERE id = '".$_GET['c_id']."'";
								$course_query = mysql_query($select_single_course) or die(mysql_error());
								
								$course_id = '';
								$course_name = '';
								$course_time= '';
								$course_from = '';
								$course_to = '';
								$course_price = '';
								$course_desc = '';
								$course_image = '';
								$course_duration = '';
								$extension_img = '';

								if(mysql_num_rows($course_query)){
									while($data = mysql_fetch_array($course_query)){
										$_SESSION['course_id'] = $data['id']; 
										$_SESSION['course_fee'] = $data['course_fee'];
										
										$course_id = $data['id'];
										$course_name = $data['course_name'];
										$course_time= $data['course_timing'];
										$course_from = $data['course_from'];
										$course_to = $data['course_to'];
										$course_price = $data['course_fee'];
										$course_desc = $data['course_description'];
										$course_image = $data['course_image'];
										$course_duration = $data['course_duration'];
									}
								}

								if($course_image){
									$temp_img = explode(".", $course_image);
									$extension_img = end($temp_img);
								}
							}
					?> 
					<?php
						if($course_id){	
					?>
						<div class="span4">
							<a href="../admin/dashboard/course_image/<?php echo $course_id.'/'.$course_id.'.'.$extension_img; ?>" class="thumbnail" data-fancybox-group="group1" title="<?php echo $course_name; ?>"><img alt="" src="admin/dashboard/course_image/<?php echo $course_id.'/'.$course_id.'.'.$extension_img; ?>"></a>
						</div>					
						<div class="span5">
							<address>
								<strong>Course Name:</strong> <span><?php echo $course_name; ?></span><br>
								<strong>Timing :</strong> <span><?php echo $course_time; ?></span><br>
								<strong>Duration :</strong> <span><?php echo $course_duration; ?></span>								
							</address>									
							<h4><strong>Price: <?php echo '$'.$course_price; ?></strong></h4>
						</div>
						<div class="span5">	
							<a href="add_to_cart.php?home=1"><button class="btn btn-inverse" type="button">Add to cart</button></a>
						</div>	
					<?php
						}else{
					?>
						<div class="span5">Wrong Course Id</div>
					<?php }
						}
						
						if(isset($_GET['ebk_chk'])){
							if(isset($_GET['c_id'])){
								$select_single_ebook = "SELECT * FROM  tbl_ebook WHERE id = '".$_GET['c_id']."'";
								$ebook_query = mysql_query($select_single_ebook) or die(mysql_error());
								
								$ebook_id = '';
								$ebook_name = '';
								$ebook_price = '';
								$ebook_desc = '';
								$ebook_image = '';
								$ebook_extension_img = '';

								if(mysql_num_rows($ebook_query)){
									while($data = mysql_fetch_array($ebook_query)){
										$_SESSION['course_id'] = $data['id']; 
										$_SESSION['course_fee'] = $data['ebook_fee'];
										
										$ebook_id = $data['id'];
										$ebook_name = $data['ebook_name'];
										$ebook_price = $data['ebook_fee'];
										$ebook_desc = $data['ebook_description'];
										$ebook_image = $data['ebook_image'];
									}
								}

								if($ebook_image){
									$temp_img = explode(".", $ebook_image);
									$ebook_extension_img = end($temp_img);
								}
							}	
						?>
					
					<?php
						if($ebook_id){	
					?>
					<div class="span4">
						<a href="../admin/dashboard/ebook_images/<?php echo $ebook_id.'/'.$ebook_id.'.'.$ebook_extension_img; ?>" class="thumbnail" data-fancybox-group="group1" title="<?php echo $ebook_name; ?>"><img alt="" src="admin/dashboard/ebook_images/<?php echo $ebook_id.'/'.$ebook_id.'.'.$ebook_extension_img; ?>"></a>
					</div>
					
					<div class="span5">
						<address>
							<strong>Ebook Name:</strong> <span><?php echo $ebook_name; ?></span><br>							
						</address>									
						<h4><strong>Price: <?php echo '$'.$ebook_price; ?></strong></h4>
					</div>
					<div class="span5">	
						<a href="add_to_cart.php?ebk=1&ebk_chk=1"><button class="btn btn-inverse" type="button">Add to cart</button></a>
					</div>	
					<?php
						}else{
					?>
						<div class="span5">Wrong Ebook Id</div>
					<?php }
					}
					?>
				</div>
				<div class="row">
					<div class="span9" style="margin-top:15px;">
						<ul class="nav nav-tabs" id="myTab">
							<li class="active"><a href="#home">Description</a></li>
						</ul>							 
						<div class="tab-content">
							<?php
								if(!isset($_GET['ebk_chk'])){
									if($course_id){	
							?>
										<div class="tab-pane active" id="home"><?php echo $course_desc; ?></div>
							<?php	}else {
										echo 'Wrong Course ID';
									}
								}
								if(isset($_GET['ebk_chk'])){
									if($ebook_id){	
							?>
										<div class="tab-pane active" id="home"><?php echo $ebook_desc; ?></div>
							<?php	}else {
										echo 'Wrong Ebook ID';
									}	
								}
							?>			
						</div>							
					</div>
				</div>
			</div>
			<?php include('template/right_panel.php'); ?>
			
		</div>
	</section>	
	<!-- /.content-section-a -->	
   
<?php include('template/footer.php'); ?>
